//下载两个包并且注册
import VueRouter from 'vue-router'
import Vue from 'vue'

//把路由包注册到Vue上后面才可以正常使用挂在，然后main.js把这个文件引入经行使用
Vue.use(VueRouter)

//创建对象指向接收路由模板
import HomeContainer from './components/HomeContainer.vue'
import MemberContainer from './components/MemberContainer.vue'
import ShopcarContainer from './components/ShopcarContainer.vue'
import SearchContainer from './components/SearchContainer.vue'
import newlist from "./components/newlist.vue"
import newdetail from "./components/newdetail.vue"
import photolist from "./components/photolist.vue"
import photodetail from "./components/photodetail.vue"
import goodlist from "./components/goodlist.vue"
import googdetail from "./components/gooddetail.vue"
import GoodsDesc from './components/GoodsDesc.vue'
import GoodsComment from './components/GoodsComment.vue'


// 3. 创建路由对象
var router = new VueRouter({
  //点击四个链接路由监听路径在相应的坑跳转
  routes: [
    { path:'/home',component:HomeContainer },
    { path:'/member',component:MemberContainer },
    { path:'/shopcar',component:ShopcarContainer },
    { path:'/search',component:SearchContainer },
    { path:'/home/newlist',component:newlist },
    { path:'/home/newdetail/:id',component:newdetail },
    { path:'/home/photolist',component:photolist },
    { path:'/home/photodetail/:id',component:photodetail },
    { path:'/home/goodlist',component:goodlist },
    { path:'/home/gooddetail/:id',component:googdetail,name:'goodsinfo'  },
    { path: '/home/goodsdesc/:id', component:GoodsDesc, name: 'goodsdesc'  },
    { path: '/home/goodscomment/:id', component: GoodsComment, name: 'goodscomment' },
    { path:'/',redirect:'/home' }
  ],
  linkActiveClass:'mui-active'


})

// 把路由对象暴露出去
export default router